#include<bits/stdc++.h>
using namespace std;
int x[1001],y[1001];
int n;
int dis(int i,int j)
{
    int xmin=x[i]-x[j];
    int ymin=y[i]-y[j];
    if (xmin<0) xmin=0-xmin;
    if (ymin<0) ymin=0-ymin;
    return xmin+ymin;
}
int f(int i)
{
    if (i<=1) return dis(1,n);
    else return f(i-1)+dis(i-1,i);
}
int g(int i)
{
    if (i>=n) return 0;
    else return g(i+1)+dis(i,i+1);
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++)
    {
        scanf("%d%d",&x[i],&y[i]);
    }
    int maxs=dis(1,n);
    for (int i=1;i<=n;i++)
    {
        int sum=f(i-1)+g(i+1)+dis(i-1,i+1);
        if(maxs>sum) maxs=sum;
    }
    printf("%d",maxs);
}